{% extends 'base.html' %}
{% block content %}
<div class="container mt-4">
    <h2>{% if object %}编辑新闻{% else %}添加新闻{% endif %}</h2>
    <form method="post">
        {% csrf_token %}
        <div class="form-group">
            {{ form.title.label_tag }}
            {{ form.title }}
        </div>
        <div class="form-group">
            {{ form.content.label_tag }}
            {{ form.content }}
        </div>
        <div class="form-group">
            {{ form.category.label_tag }}
            {{ form.category }}
        </div>
        <div class="form-group">
            {{ form.is_published.label_tag }}
            {{ form.is_published }}
        </div>
        <button type="submit" class="btn btn-primary">保存</button>
        <a href="{% url 'news-list' %}" class="btn btn-secondary">取消</a>
    </form>
</div>
{% endblock %}